/**
 * 校园二手书交易平台样式
 */

/* Base Styles */
:root {
    --primary-color: #4caf50;
    --secondary-color: #343a40;
    --accent-color: #f8f9fa;
    --text-color: #212529;
    --muted-color: #6c757d;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --animation-speed: 0.3s;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

/* Page Loader */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn var(--animation-speed) ease;
}

.slide-in {
    animation: slideIn var(--animation-speed) ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    transition: all var(--animation-speed) ease;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-dark .navbar-brand {
    color: #fff;
}

.nav-link {
    position: relative;
    font-weight: 500;
    margin: 0 5px;
    transition: all var(--animation-speed) ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: all var(--animation-speed) ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform var(--animation-speed) ease, box-shadow var(--animation-speed) ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-img-top {
    transition: transform var(--animation-speed) ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Book Card Styles */
.book-card {
    margin-bottom: 30px;
}

.book-image {
    height: 200px;
    object-fit: cover;
    transition: all var(--animation-speed) ease;
}

.status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.card-footer {
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    padding: 10px 15px;
}

/* Forms */
.form-control {
    border-radius: 8px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    transition: all var(--animation-speed) ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
}

/* Form cards */
.form-card, .profile-card, .password-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    transition: transform var(--animation-speed) ease;
}

.form-title, .profile-title, .password-title {
    margin-bottom: 30px;
    text-align: center;
    color: var(--primary-color);
    font-weight: 700;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all var(--animation-speed) ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #43a047;
    border-color: #43a047;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Password Strength */
.password-strength {
    margin-top: 10px;
    height: 5px;
}

.password-tips {
    list-style-type: none;
    padding-left: 0;
    margin-top: 15px;
}

.password-tips li {
    margin-bottom: 5px;
    color: var(--muted-color);
    transition: color var(--animation-speed) ease;
}

.password-tips li.valid {
    color: var(--success-color);
}

.password-tips li i {
    margin-right: 5px;
}

/* Search Components */
#searchContainer {
    position: relative;
}

#searchInput {
    padding-right: 40px;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 12px;
    color: var(--muted-color);
    transition: color var(--animation-speed) ease;
}

#searchInput:focus + .search-icon {
    color: var(--primary-color);
}

#searchSuggestions {
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: none;
}

.suggestion-img {
    width: 40px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.suggestion-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image Uploads */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    transition: all var(--animation-speed) ease;
}

#uploadProgress {
    margin-top: 10px;
    display: none;
}

/* Stats Cards */
.stat-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform var(--animation-speed) ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
    display: block;
}

.stat-title {
    color: var(--muted-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Footer */
.footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer h5 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
    transition: color var(--animation-speed) ease;
}

.footer a:hover {
    color: #fff;
    text-decoration: none;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.alert-dismissible .close {
    padding: 0.5rem 1.25rem;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
    line-height: 1;
    vertical-align: middle;
}

/* Media Queries */
@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .form-card, .profile-card, .password-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .footer {
        padding: 30px 0 20px;
    }
}

/* Animation for page content */
.page-content {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lazy Loading Images */
.lazy-load {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

img.loaded {
    opacity: 1;
}

/* Book Condition Badges */
.condition-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.condition-1 {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.condition-2 {
    background-color: #dcedc8;
    color: #558b2f;
}

.condition-3 {
    background-color: #fff9c4;
    color: #f9a825;
}

.condition-4 {
    background-color: #ffe0b2;
    color: #ef6c00;
}

.condition-5 {
    background-color: #ffccbc;
    color: #d84315;
}

/* Filter Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-weight: 600;
    color: var(--muted-color);
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-bottom-color: var(--primary-color);
}

/* Search Box Enhancement */
.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-box .form-control {
    padding-left: 45px;
    height: 50px;
    border-radius: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.search-box .search-icon {
    position: absolute;
    left: 15px;
    top: 13px;
    font-size: 1.2rem;
    color: var(--muted-color);
}

/* Price Display */
.price-tag {
    color: var(--danger-color);
    font-weight: 700;
    font-size: 1.5rem;
}

.original-price {
    text-decoration: line-through;
    color: var(--muted-color);
    margin-left: 0.5rem;
}

/* Tooltip Enhancement */
.tooltip {
    font-size: 0.8rem;
}

.tooltip-inner {
    padding: 8px 12px;
    border-radius: 4px;
}

/* Book Category Tags */
.category-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e9ecef;
    color: var(--muted-color);
    margin-right: 5px;
    margin-bottom: 5px;
    transition: all var(--animation-speed) ease;
}

.category-tag:hover {
    background-color: var(--primary-color);
    color: white;
}

/* 编辑表单样式 */
.edit-form {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.edit-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

.required-field::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 4px;
} 